﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>JQuery Ajax 测试</title>
    <script src="~/Scripts/jquery-2.1.0.js"></script>
    <script src="~/Scripts/jquery.validate.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
    <script src="~/Scripts/jquery-2.1.0-vsdoc.js"></script>

    <script type="text/javascript">
        function test() {
            $.ajax({
                url: "/Ajax/GetTestData",
                type: "POST",
                success: function (result) {
                    alert('123');
                    $("#lblMsg").text(result.msg);
                }
            });
        }

        function GetTime() {

            $.get("/Home/Index");

            $.get("Ajax/GetTime", function (response) {
                $("#myPnl").html(response);
            });

            return false;
        }
    </script>


</head>
<body>

    <h2 id="lblMsg"></h2>
    <input type="button" value="测试" onclick="test();" />
    <br />

    @Ajax.ActionLink("取得目前时间", "GetTime", new AjaxOptions { UpdateTargetId = "Now"})
    <div id="Now"></div>
    <br />

    @*<div id="myPnl" style="width: 300px; height: 30px; border: 1px dotted silver;">
        </div>
        <a href="#" onclick="return GetTime();">Click Me</a>

        <div>
            <input type="button" id="send" name="name" value="Ajax获取" />
            <div id="resTest" style="background-color:aqua">123</div>
        </div>*@
</body>
</html>